#include <iostream>
using namespace std;
typedef struct tree
{
	struct tree* left;
	struct tree* right;
	char val;
}Tree;

void Preorder(Tree* root, char* arr, int& i)
{
	if (arr[i] == '#')
	{
		root = NULL;
		i++;
		return;
	}
	root = (Tree*)malloc(sizeof(Tree));
	root->val = arr[i++];
	Preorder(root->left, arr, i);
	Preorder(root->right, arr, i);
}
void Inorder(Tree* root)
{
	if (root == NULL)
	{
		return;
	}
	Inorder(root->left);
	printf("%d", root->val);
	Inorder(root->right);
}



//int main()
//{
//	char* arr = (char*)malloc(100);
//	cin >> arr;
//	printf("%s", arr);
//	Tree* root = (Tree*)malloc(sizeof(Tree));
//	int i = 0;
//	Preorder(root, arr, i);
//	// Inorder(root);
//	return 0;
//}